//
//  WTPrivateLetterLeftCell.m
//  66TV
//
//  Created by ben on 16/7/30.
//  Copyright © 2016年 shifeng. All rights reserved.
//

#import "WTPrivateLetterLeftCell.h"
#import "UIImageView+WebCache.h"
#import "UIColor+WTExtend.h"
#import "UIImage+WTExtend.h"

@implementation WTPrivateLetterLeftCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    self.iconImageView.layer.cornerRadius = 17;
    self.iconImageView.layer.masksToBounds = YES;
    
    self.messageBodyLabel.left = 6;
    self.messageBodyLabel.right = 6;
    self.messageBodyLabel.top = 4;
    self.messageBodyLabel.bottom = 4;
    
    self.messageBodyLabel.layer.cornerRadius = 5;
    self.messageBodyLabel.layer.masksToBounds = YES;
}


- (void)setMessageModel:(WTBaseMessageModel *)messageModel{
    _messageModel = messageModel;

    NSMutableParagraphStyle* defaultParagraphStyle = [[NSMutableParagraphStyle defaultParagraphStyle] mutableCopy];
    defaultParagraphStyle.lineSpacing = 4;
    NSString* text = [NSString stringWithFormat:@"%@",messageModel.chat_message_text];
    NSDictionary* attribute = @{NSParagraphStyleAttributeName:defaultParagraphStyle,NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:[UIColor hexChangeFloat:@"323232"]};
    NSMutableAttributedString* string = [[NSMutableAttributedString alloc] initWithString:text attributes:attribute];
    self.messageBodyLabel.attributedText = string;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:messageModel.chat_message_avtar_icon] placeholderImage:[UIImage wt_imageWithName:@"wt_avatar"]];
}
@end
